# -*- coding: utf-8 -*-
# _author: zb
# date: 19-4-28 下午3:01

import xadmin
from xadmin import views

from . import models


# 增加里xadmin的相关功能

class BaseSetting(object):
    """xadmin的基本配置"""
    enable_thems = True  # 开启主题切换功能
    use_bootswatch = True


xadmin.site.register(views.BaseAdminView, BaseSetting)


class GlobalSettings(object):
    """xadmin的全局配置"""
    site_title = "mlh问答某块管理系统"
    site_footer = "mlh页脚"
    menu_style = "accordion"


xadmin.site.register(views.CommAdminView, GlobalSettings)


class QuesAdmin(object):
    model_icon = 'fa fa-gift'
    list_display = ['id', 'user', 'label', 'content']
    search_fields = ['id', 'label']
    list_filter = ['label']


xadmin.site.register(models.QuesModel, QuesAdmin)


class QuattrAdmin(object):
    model_icon = 'fa fa-gift'
    list_display = ['ques', 'answer_count', 'click_count', 'report_count', 'answer']


xadmin.site.register(models.QattrModel, QuattrAdmin)
